Repository navigation
fix(libc): preserve strftime literal conversions - #3653
Merged
oneandonlydean merged 3 commits intoOct 12, 2026
Merged
Conversation
Normalize FreeBSD 11.4 literal conversions before host formatting. AI-assisted: yes
Exercise unknown, repeated and incomplete conversions, percent escaping and buffer boundaries. AI-assisted: yes
Record literal handling while retaining unimplemented padding and timezone gaps. AI-assisted: yes
Contributor
|
Independent pre-review on Linux (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
|
9 tasks done
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
strftime("%Q")currently returns 0 on Windows instead of the literalQproduced by FreeBSD 11.4. A trailing%, incomplete modifiers and repeatedE/Oor padding modifiers have the same host-dependent problem.Parse those literals before calling the host formatter, escaping literal percent signs so a following character cannot become a new conversion. Preserve ordinary conversions and the existing
%k,%l,%s,%vand%+expansion. Update TechnicalDebt to retain the remaining padding and timezone gaps.The behavior follows _fmt in FreeBSD 11.4 strftime.c, including its repeated-modifier and end-of-format branches.
%Pis unknown in that version and becomes literalP.Tested
libstarget passed.guest_time_conversionregression fails against unchanged main at%Qand passes with this fix. It covers 27 format cases, exact-fit and undersized buffers, empty formats and a zero-size buffer.guest_time_conversion,guest_formatting,guest_wide_formatting,guest_errors,guest_localeandguest_freebsd_clockspassed five consecutive runs each (30 executions).-O0and-O3. Portability shims replace locale lookup, types and hostmktime; known padded conversions and standalone%z/%Zare excluded. No reference code or investigation files are added to the repository.wcsftimein the same source file and delegates to the existingstrftime; it does not implement this literal-conversion fix. A merge check combines the source automatically; the adjacent TechnicalDebt changes need resolution if both PRs merge. The closed timezone fix fix(libc): preserve guest time zones in Windows strftime #2665 is a separate gap.git diff --checkpassed. Linux runtime and console/game testing were not performed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)